/**
    Copyright (C) 2012 Guido Ludwig

    This file is part of JATT.
	http://code.google.com/p/jatt/

    JATT is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package de.guidoludwig.jatt;

import de.guidoludwig.jatt.chain.JATTChain;
import de.guidoludwig.jatt.chain.commands.config.CleanupImagesConfig;
import de.guidoludwig.jatt.chain.commands.config.ClearConfig;
import de.guidoludwig.jatt.chain.commands.config.CollectArtworkConfig;
import de.guidoludwig.jatt.chain.commands.config.ExtractArtworkConfig;
import de.guidoludwig.jatt.chain.commands.config.FolderScanConfig;
import de.guidoludwig.jatt.chain.commands.config.LastFMConfig;
import de.guidoludwig.jatt.chain.commands.config.SelectOptimizedImageConfig;
import de.guidoludwig.jatt.chain.commands.config.ValidationConfig;
import de.guidoludwig.jatt.chain.commands.config.WriteArtworkConfig;

/**
 * @author Guido Ludwig
 */
public abstract class JATTConfigBase implements JATTConfig {

	private final FolderScanConfig scanConfig;
	private final ExtractArtworkConfig extractConfig;
	private final ClearConfig clearConfig;
	private final LastFMConfig lastfmConfig;
	private final SelectOptimizedImageConfig selectOptimizedConfig;
	private final CleanupImagesConfig cleanupConfig;
	private final WriteArtworkConfig writeArtConfig;
	private final CollectArtworkConfig collectArtConfig;
	private final ValidationConfig validationConfig;

	public JATTConfigBase() {
		scanConfig = new FolderScanConfig();
		extractConfig = new ExtractArtworkConfig();
		clearConfig = new ClearConfig();
		lastfmConfig = new LastFMConfig();
		selectOptimizedConfig = new SelectOptimizedImageConfig();
		cleanupConfig = new CleanupImagesConfig();
		writeArtConfig = new WriteArtworkConfig();
		validationConfig = new ValidationConfig();
		collectArtConfig = new CollectArtworkConfig();
	}

	protected void configure() {
		configure(scanConfig);
		configure(extractConfig);
		configure(clearConfig);
		configure(lastfmConfig);
		configure(selectOptimizedConfig);
		configure(cleanupConfig);
		configure(writeArtConfig);
		configure(validationConfig);
		configure(collectArtConfig);
	}

	// protected abstract void configure(FolderScanConfig config);
	private void configure(FolderScanConfig config) {
		// Nothing to do
	}

	protected abstract void configure(ExtractArtworkConfig config);

	protected abstract void configure(ClearConfig config);

	protected abstract void configure(LastFMConfig config);

	protected abstract void configure(SelectOptimizedImageConfig config);

	protected abstract void configure(CleanupImagesConfig config);

	protected abstract void configure(WriteArtworkConfig config);

	protected abstract void configure(ValidationConfig config);
	
	protected abstract void configure(CollectArtworkConfig config);

	@Override
	public void applyToChain(JATTChain chain) {

		chain.getScanCommand().configure(scanConfig);
		chain.getExtractCommand().configure(extractConfig);
		chain.getClearCommand().configure(clearConfig);
		chain.getLastfmCommand().configure(lastfmConfig);
		chain.getSelectOptimizedCommand().configure(selectOptimizedConfig);
		chain.getCleanupCommand().configure(cleanupConfig);
		chain.getWriteArtCommand().configure(writeArtConfig);
		chain.getCollectArtworkCommand().configure(collectArtConfig);
		chain.getValidationCommand().configure(validationConfig);
	}

}
